package com.bjpowernode.boss.convert;

import com.bjpowernode.boss.convert.help.CommonFun;
import com.bjpowernode.boss.dao.entity.UserInfo;
import com.bjpowernode.boss.mvc.models.form.user.UserEditForm;
import com.bjpowernode.boss.mvc.models.vo.user.UserInfoVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * bean转化
 *
 * @author yu
 * @date 2024/7/11 10:33
 */

@Mapper(componentModel = "spring", uses = {CommonFun.class})
public interface UserConvert {

    List<UserInfoVo> toListUserInfoVo(List<UserInfo> userInfoList) ;

    @Mappings({
            @Mapping(source = "userEmail", target = "email"),
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:SS"),
            @Mapping(source = "status", target = "status", qualifiedByName = "transPublicStatus")
    })
    UserInfoVo mapUserInfoVo(UserInfo userInfo) ;

    @Mappings({
            @Mapping(source = "email", target = "userEmail")
    })
    UserInfo mapUserInfo(UserEditForm userEditForm) ;
}
